package utils;

import org.apache.commons.io.filefilter.IOFileFilter;

import java.io.File;
import java.util.Collection;

public class MyFileUtils {
    public static Collection<File> getFile(String dir){
        Collection<File> files = org.apache.commons.io.FileUtils.listFiles(new File(dir), new IOFileFilter() {
            @Override
            public boolean accept(File file) {
                if(file.getName().startsWith("txdt_")){
                    return true;
                }
                return false;
            }

            @Override
            public boolean accept(File file, String s) {
                if(file.getName().startsWith("txdt_")){
                    return true;
                }
                return false;
            }
        }, new IOFileFilter() {
            @Override
            public boolean accept(File file) {
                return true;
            }

            @Override
            public boolean accept(File file, String s) {
                return true;
            }
        });
        return files;
    }

    public static void main(String[] args) {
        Collection<File> list= MyFileUtils.getFile( "D:\\AutoScreenCapture");
        System.out.println(list.size());
    }
}
